package com.ayuku.course.ui;

import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.widgets.Link;

public class AboutDlg extends Dialog {

	protected Object result;
	protected Shell shlAbout;
	/**
	 * Create the dialog.
	 * @param parent
	 * @param style
	 */
	public AboutDlg(Shell parent, int style) {
		super(parent, style);
		setText("SWT Dialog");
	}
	/**
	 * Open the dialog.
	 * @return the result
	 */
	public Object open() {
		createContents();
		shlAbout.open();
		shlAbout.layout();
		Display display = getParent().getDisplay();
		while (!shlAbout.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		return result;
	}
	/**
	 * Create contents of the dialog.
	 */
	private void createContents() {
		shlAbout = new Shell(getParent(), getStyle());
		shlAbout.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		shlAbout.setSize(583, 317);
		shlAbout.setText("About");
		
		Label label = new Label(shlAbout, SWT.NONE);
		label.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		label.setText("AyCode Simple Course");
		label.setFont(SWTResourceManager.getFont("Segoe UI", 15, SWT.NORMAL));
		label.setAlignment(SWT.CENTER);
		label.setBounds(114, 10, 318, 30);
		
		Label label_1 = new Label(shlAbout, SWT.NONE);
		label_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		label_1.setText("Developed by: pKusuma");
		label_1.setAlignment(SWT.CENTER);
		label_1.setBounds(124, 46, 307, 15);
		
		Link link = new Link(shlAbout, 0);
		link.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		link.setText("Website: <a href=\"http://www.ayukucode.org\">AyukuCode.org</a>");
		link.setBounds(217, 69, 163, 23);
		
		Label label_2 = new Label(shlAbout, SWT.NONE);
		label_2.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		label_2.setText("This simple Application use:");
		label_2.setAlignment(SWT.CENTER);
		label_2.setBounds(165, 133, 267, 15);
		
		Link link_1 = new Link(shlAbout, 0);
		link_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		link_1.setText("GUI Designer: <a href=\"http://www.eclipse.org/windowbuilder/\">Window Builder</a>");
		link_1.setBounds(240, 154, 156, 15);
		
		Link link_2 = new Link(shlAbout, 0);
		link_2.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		link_2.setText("Database: <a href=\"http://www.sqlite.org/\">SQLite.org</a>");
		link_2.setBounds(240, 175, 156, 15);
		
		Link link_3 = new Link(shlAbout, 0);
		link_3.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		link_3.setText("Reporting: <a href=\"http://code.google.com/p/swt-paperclips/\">Paperclips</a>");
		link_3.setBounds(240, 196, 156, 15);
		
		Link link_4 = new Link(shlAbout, 0);
		link_4.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		link_4.setText("Simple ORM: <a href=\"https://github.com/rufiao/persist\">Persist</a>");
		link_4.setBounds(240, 217, 156, 15);

	}

}
